#include <iostream>

using namespace std;

const int maxn = 500005;

int d[maxn];
int n, m; 

inline int lowbit(int x) {
	return x & (-x);
}

int ask(int r) {
	int res = 0;
	while(r) {
		res += d[r];
		r   -= lowbit(r);
	}
	
	return res;
}

void update(int x, int y) {
	while(x <= n) {
		d[x] += y;
		x    += lowbit(x);
	}
}


int main()
{
	int a;
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; i++) {
		cin >> a;
		update(i, a);
	}
	
	for(int i = 1; i <= m; i++) {
		int tp, x, k;
		cin >> tp >> x >> k;
		if(1 == tp) {
			update(x, k);
		} else {
			// cout << ask(k) - ask(x - 1) << endl;
			printf("%d\n", ask(k) - ask(x - 1));
		}
	}
	
	return 0;
}
